package com.lala.rennigou.service;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.lala.rennigou.mapper.EasybuyOrderMapper;
import com.lala.rennigou.pojo.EasybuyOrder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class EasybuyOrderServiceImpl implements EasybuyOrderService {
    @Autowired
    private EasybuyOrderMapper easybuyOrderMapper;
    @Override
    public int addOrder(EasybuyOrder easybuyOrder) {
        return easybuyOrderMapper.insert(easybuyOrder);
    }

    @Override
    public PageInfo<EasybuyOrder> myOrder(int userid,int p) {
        PageHelper.startPage(p,4);
        PageInfo<EasybuyOrder> pageInfo=new PageInfo<>(easybuyOrderMapper.myOrder(userid));
        return pageInfo;
    }

    @Override
    public PageInfo<EasybuyOrder> allOrder(int p) {
        PageHelper.startPage(p,4);
        PageInfo<EasybuyOrder> pageInfo=new PageInfo<>(easybuyOrderMapper.allOrder());
        return pageInfo;
    }

    @Override
    public List<EasybuyOrder> selectByID(int userid) {
        return easybuyOrderMapper.selectByID(userid);
    }

    @Override
    public EasybuyOrder selectById(int id) {
        return easybuyOrderMapper.selectById(id);
    }

    @Override
    public int tuikuan(int id) {
        return easybuyOrderMapper.tuikuan(id);
    }
}
